import request from '@/utils/request'

/**
 * 分页查询讲解预约列表
 * @param {number} page - 页码
 * @param {number} pageSize - 每页条数
 * @param {Object} params - 查询参数
 * @returns {Promise} 请求结果
 */
export function getGuideAppointmentPage(page = 1, pageSize = 10, params = {}) {
  return request({
    url: '/guide/appointment/page',
    method: 'get',
    params: {
      page,
      pageSize,
      ...params
    }
  })
}

/**
 * 根据ID查询讲解预约
 * @param {number} id - 讲解预约ID
 * @returns {Promise} 请求结果
 */
export function getGuideAppointmentById(id) {
  return request({
    url: `/guide/appointment/${id}`,
    method: 'get'
  })
}

/**
 * 新增讲解预约
 * @param {Object} data - 讲解预约数据
 * @returns {Promise} 请求结果
 */
export function saveGuideAppointment(data) {
  return request({
    url: '/guide/appointment',
    method: 'post',
    data
  })
}

/**
 * 修改讲解预约
 * @param {Object} data - 讲解预约数据
 * @returns {Promise} 请求结果
 */
export function updateGuideAppointment(data) {
  return request({
    url: '/guide/appointment',
    method: 'put',
    data
  })
}

/**
 * 删除讲解预约
 * @param {number} id - 讲解预约ID
 * @returns {Promise} 请求结果
 */
export function deleteGuideAppointment(id) {
  return request({
    url: `/guide/appointment/${id}`,
    method: 'delete'
  })
}

/**
 * 获取讲解预约状态统计
 * @returns {Promise} 请求结果
 */
export function getGuideAppointmentStats() {
  return request({
    url: '/guide/appointment/stats',
    method: 'get'
  })
}

/**
 * 讲解预约审批
 * @param {number} id - 讲解预约ID
 * @param {string} status - 状态 (APPROVED/REJECTED)
 * @param {string} remark - 备注
 * @returns {Promise} 请求结果
 */
export function approveGuideAppointment(id, status, remark) {
  return request({
    url: `/guide/appointment/approve/${id}`,
    method: 'put',
    data: {
      status,
      remark
    }
  })
} 